package com.feihong.txgw.ui.activity.kaika;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.webkit.JavascriptInterface;

import com.blankj.utilcode.util.LogUtils;
import com.feihong.txgw.ui.activity.order.KaiKaOrderDetailActivity;

/**
 * @name txgw_app
 * @class name：com.feihong.txgw.ui.activity.kaika
 * @class describe:
 * @author wangziheng
 * @time 2017/9/28 13:35
 * @change
 * @chang time
 * @class describe
 */
public class KaikaDetailInterface {
    private KaiKaOrderDetailActivity.KaikaDetailCallBack mCallBack;

    public KaikaDetailInterface(Context context, KaiKaOrderDetailActivity.KaikaDetailCallBack callBack) {
        mCallBack = callBack;
    }

    private Handler deliver = new Handler(Looper.getMainLooper());

    @JavascriptInterface
    public void pay_order(final String data) {
        deliver.post(new Runnable() {
            @Override
            public void run() {
                mCallBack.pay_order(data);
            }
        });
        LogUtils.i("通讯顾问 :"+"开卡支付订单-->"+data);
    }

    @JavascriptInterface
    public void add_info(final String data) {
        LogUtils.i("通讯顾问 :"+"开卡补传信息-->"+data);
        deliver.post(new Runnable() {
            @Override
            public void run() {
                mCallBack.add_info(data);
            }
        });
    }

    @JavascriptInterface
    public void cancel_order(final String data) {
        LogUtils.i("通讯顾问 :"+"开卡取消订单-->"+data);
        deliver.post(new Runnable() {
            @Override
            public void run() {
                mCallBack.cancel_order(data);
            }
        });
    }
}
